package com.goldcn.goods.controller;

import com.goldcn.goods.vo.ClazzImageVo;
import com.goldcn.goods.service.GoodsClassifyCommissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2016/12/1.
 */
@RestController
@RequestMapping("/clazz")
@Api(value = "商品分类", description = "商品微服务二")
public class GoodsClazzController {

    @Autowired
    private GoodsClassifyCommissionService goodsClassifyCommissionService;


    @ApiOperation(value="操作（新增或修改）分类图片")
    @RequestMapping(value = "/image",method = RequestMethod.POST)
    public Object operateGoods(@RequestBody ClazzImageVo clazzImageVo){
        return goodsClassifyCommissionService.operateClazzImage(clazzImageVo);
    }

    @ApiOperation(value="查询分类是否有专题")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="path",name="subjectID",required=true,value="专题ID",defaultValue="1231231"),
    })
    @RequestMapping(value = "/subject/{subjectID}",method = RequestMethod.GET)
    public Object queryClazzSubject(@PathVariable Long subjectID){
        return goodsClassifyCommissionService.queryClazzSubject(subjectID);
    }

    @ApiOperation(value="更新专题图片信息")
    @RequestMapping(value = "/subject",method = RequestMethod.POST)
    public Object updateBySubjectID(@RequestBody ClazzImageVo clazzImageVo){
        return goodsClassifyCommissionService.updateBySubjectID(clazzImageVo);
    }

}
